package com.qiyu.tech.tcc.starter.controller;

import com.qiyu.tech.tcc.starter.dao.UserDao;
import com.qiyu.tech.tcc.starter.service.TransactionService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author linhao
 * @date created in 8:03 下午 2020/11/3
 */
@RestController
@RequestMapping(value = "/tcc")
public class TccController {

    @Resource
    private TransactionService transactionService;

    @GetMapping(value = "/doTcc")
    public String doTcc(){
        System.out.println("this is tcc");
        return "tcc-test";
    }


    @GetMapping(value = "/v2/doTcc")
    public String doTcc2(int userId,int goodsId,int stock){
        System.out.println("do tcc 2");
        transactionService.doTccVersion2(userId,goodsId,stock);
        return "do-tcc-02";
    }
}
